# https://gitee.com/yueyinqiu5990/tj12413601/blob/master/assignment1/question4/main_fourier_transform.py
import torch

from fourier_transform import discrete_fourier_transform


def _calculate_and_print(values):
    print(f"正在针对 {values} 计算 DFT ……")
    tensor = torch.tensor(values, dtype=torch.complex128)
    print(f"计算结果：{discrete_fourier_transform(tensor)}")
    print(f"torch.fft 的结果：{torch.fft.fft(tensor)}")
    print()


def _main():
    _calculate_and_print([13., 17, 19, 23])
    _calculate_and_print([4 - 1j, 2 + 1j, 2 + 1j, -1j, 2 - 1j, 4 + 1j, 4 + 1j, 1j])


if __name__ == "__main__":
    _main()
